#include "ui.h"
#include "agingDeamon.h"

int main(int argc, char** argv )
{
	if (argc > 1)
	{
		char* fileName = argv[1];
		//fileName = "configFile.txt";

		pthread_t ui;
		initRW();
		initPRM();
		readConfFile(fileName);	//read config file
		initProcesses();		//init the processes array
		initMainMemory();		//init the Main memory
		initDiskMemory();		//init the Disk memory
		initAgingDeamon();		//init the Aging deamon

		pthread_create(&ui,NULL,(void*)runUI,fileName);

		pthread_join(ui,NULL);
		killProcesses();
		killAgingDeamon();
		killPCB();
		killRW();
		killMM();
		killDiskMemory();
		killPRM();
	}
	else printf("wrong config file name");
	return 0;
}
